#ifndef H_RCGD_COMMAND_H
#define H_RCGD_COMMAND_H

#define CMD_PARAMETER_LENGTH	300
/* Command.SERVICE */
#define CMD_PRE_INPUT	0
#define	CMD_INPUT		1
#define	CMD_PARSING		2
#define	CMD_EXECUTION 	3
#define	CMD_REPLY 		4


typedef struct CMD_S{
	char	CommandSet;
	char	CallCount;
	char	Port;
	short	ID;
	char	Parameter[CMD_PARAMETER_LENGTH];
} CMD_;


#define MAX_COMMAND_CASCADE	20
typedef struct Command_S{
	char	SERVICE;
	char	COMMAND_SET;
	int		Count;
	int		Current;
	char 	Input[CMD_PARAMETER_LENGTH];
	char	Output[CMD_PARAMETER_LENGTH];
	CMD_	Queue[MAX_COMMAND_CASCADE];
}Command_;


typedef struct Common_Command_S{
	Command_ COMMON_PORT;
	Command_ CTRL_PORT;
} COMMAND_;


#define	EXE_END			0
#define	EXE_ERROR		1
#define	EXE_ING			2



#define ASCII			0
#define BINARY			1
#define TEXT			2
#define UART_CONTROL	3


#define NOW				100
#define TOD_CALC_START	9



extern COMMAND_	COMMAND;

extern void Init_COMMAND(void);
extern void ExecuteCommand(char);
extern void ReplyCommand(char);
extern void STATUS_OUT(int,char);
extern void TOD_OUT(int,char);
void SetCommand(char port);


#endif
